<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			function cal(){
				var x=document.getElementsByName("a");
				var result=document.getElementsByName("rs");
				var z=parseFloat(x[0].value);
				var zz= z.toString();
				
				result[0].value=parseInt(zz[0]);
				
			}
			
			
		</script>
	</head>
	<body>
		 输入一个正整数:
		  <input type="number" name="a" />
		  <button id="" onclick="cal()" >最高位</button>
		   <input type="text" name="rs" />
	</body>
</html>